package UIFree.FX.pageturner
{
	import UIFree.uif_ecomponent;
	
	public class pt_maskTurner extends pt_basePageTurner {
		private var _mask: uif_ecomponent;
		public function pt_maskTurner(parent:uif_ecomponent, a_transition:Function=null, a_fps:Number=20, a_duration:Number=1500)
		{
			super(parent, a_transition, a_fps, a_duration);
			_mask = createMask();
		}
		
		protected function get slideMask(): uif_ecomponent {
			return _mask;
		}
		
		protected function createMask(): uif_ecomponent {
			return new uif_ecomponent(this);
		} 
		
		override protected function startFX(): void {
			_mask.x = endBitmap.x;
			_mask.y = endBitmap.y;
			_mask.resize(endBitmap.width, endBitmap.height);
			
			addChild(startBitmap);
			addChild(endBitmap);
			
			endBitmap.mask = _mask;
			endBitmap.alpha = 0;
		}
		
		override protected function endFX(): void {
			removeChild(startBitmap);
			removeChild(endBitmap);
		}
		
		override protected function updateFromState(): void {
			_mask.graphics.clear();
			paintMask();
			//			startBitmap.alpha = 1 - state;
			endBitmap.alpha = state;
		}
		
		protected function paintMask(): void {
			
		}				
	}
}